package com.vanysoft.business.sys.dao;

import com.baomidou.mybatisplus.plugins.Page;
import com.vanysoft.business.sys.entity.Role;
import com.vanysoft.framework.config.database.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @author qi_ma
 */
public interface RoleMapper extends BaseMapper<Role> {
    /**
     * 根据用户ID查询所有角色
     *
     * @param userId 用户ID
     * @return 组织机构列表
     */
    List<Role> selectByUserId(@Param("userId") String userId);

    List<Role> selectAll(Page<Role> page, Map<String, Object> condition);

    List<Role> selectAll(Map<String, Object> condition);

    Integer selectCount(Map<String, Object> condition);

    Integer deleteByRoleIdAndUserIds(@Param("roleId") String roleId, @Param("userIds") String[] userIds);

    Integer deleteByIds(@Param("ids") String[] ids);

    Integer addRoleUsers(@Param("roleId") String roleId, @Param("userIds") String[] userIds);

    Integer updateOrgCodes(@Param("roleId") String roleId, @Param("orgCodes") String[] orgCodes);
}
